package com.sxhnpg.dao;

import java.util.List;


import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;

import com.sxhnpg.model.User;
import com.sxhnpg.model.UserDetail;

public class UserDetailDao extends BaseDao {

	public Class getEntityClass() {
		return UserDetail.class;
	}
	// 用户登录
	public UserDetail find(String userid){
		UserDetail userDetail=null;
		Session session = getSession();
		if( session != null ){
			Criteria criteria =getSession().createCriteria(getEntityClass());
			criteria.add(Restrictions.eq("userid", userid));
			
			List<UserDetail> userDetailList = criteria.list();
			
			if(userDetailList!=null && userDetailList.size()>0) {
				userDetail = userDetailList.get(0);
			}
		}		
		return userDetail;
	}
}
